package com.crm.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;
import com.crm.services.OperatorServices;
import com.crm.services.UserServices;
import com.github.pagehelper.PageInfo;

/**
 * 操作日志控制器
 * @author Menghui
 *
 */
@Controller
@RequestMapping("customer")
public class OperatorController {
	
	@Autowired
	OperatorServices os;//操作日志服务类
	
	/**
	 * 查询操作日志
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("/tranferLog")
	public ModelAndView tranferLog(Integer pageNum, Integer pageSize) {
		if (pageNum == null)
			pageNum = 1;
		if (pageSize == null)
			pageSize = 6;
		ModelAndView mView=new ModelAndView("customer/tranferLog");
		System.out.println("转移日志+++");
		List<Map<String, String>> selectAll = os.selectAllOer(pageNum, pageSize);
		String jsonString=JSONObject.toJSONString(selectAll);
		
		PageInfo<Map<String, String>> pager = new PageInfo<Map<String, String>>(selectAll);
		System.out.println(pager);
		String json=JSONObject.toJSONString(pager);
		
		mView.addObject("list",jsonString);
		mView.addObject("page",pager);
		mView.addObject("pagejson",json);
		return mView;
	}

}

